package reflect;

public class ReflectDemo1 {
    public static void main(String[] args) throws Exception{
        //1.直接通过Class调用静态方法forName()
        Class clazz1 = Class.forName("reflect.ReflectDemo1");
        System.out.println("clazz1 = " + clazz1);
        //2.通过类名直接调用class属性
        Class clazz2 = ReflectDemo1.class;
        System.out.println("clazz2 = " + clazz2);
        //3.通过对象调用getClass()方法
        ReflectDemo1 rd1 = new ReflectDemo1();
        Class clazz3 = rd1.getClass();
        System.out.println("clazz3 = " + clazz3);
    }
}
